home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1998 January: Mac OS SDK / Dev.CD Jan 98 SDK1.toast / Development Kits (Disc 1) / QuickDraw 3D / RAVE SDK 1.5 MacOS / RaveDemo / Steve's utils / utils1.c < prev   
Encoding:
C/C++ Source or Header  |  1997-08-14  |  654 b   |  49 lines  |  [TEXT/CWIE]

  1. #include <QuickDraw.h>
  2.  
  3. #include "utils.h"
  4.  
  5.  
  6.  
  7.  
  8. void LocalToGlobalRect(Rect * r)
  9. {
  10.     LocalToGlobal(TopLeft(r));
  11.     LocalToGlobal(BottomRight(r));
  12. }
  13.  
  14. void WindowGlobalPortRect(WindowPtr w, Rect * globalRect)
  15. {
  16.     Rect r;
  17.     GrafPtr tempPort;
  18.     
  19.     /*******/
  20.     
  21.     r = w->portRect;
  22.     
  23.     GetPort(&tempPort);
  24.     SetPort(w);
  25.     LocalToGlobalRect(&r);
  26.     SetPort(tempPort);
  27.  
  28.     *globalRect = r;
  29. }
  30.  
  31. GDHandle WindowMaxGDev(WindowPtr w)
  32. {
  33.     Rect r;
  34.     
  35.     /*********/
  36.     
  37.     WindowGlobalPortRect(w, &r);
  38.  
  39.     return GetMaxDevice(&r);
  40.  
  41. }
  42.  
  43. float SingleRandom(float limit)
  44. {    unsigned long x;
  45.  
  46.     x = (unsigned short)Random() + ((unsigned short)Random() << 16);
  47.  
  48.     return (float)x / 4294967296.0 * limit;
  49. }